FontResize = ScrW() / 1280

surface.CreateFont("arial",FontResize*18,400,true,false,"NotifFont")

function PP.Notify( UMSG )
	surface.SetFont( "NotifFont" )
	local msg = UMSG:ReadString()
	local time = UMSG:ReadShort() 
	
	local StartTime = CurTime()
	local Fade = 0.5
	
	Print( "Message recieved! " .. msg )
	
	local w,h = surface.GetTextSize( msg )
	local dw = w
	local w = w + 150
	
	local function Display()
	
		local alpha = 255
		local DoomTime = CurTime() - StartTime
		
		if DoomTime > time then
			hook.Remove( "HUDPaint", "PP.NotifyDraw" )
			return
		end
		
		if Fade - DoomTime > 0 then
			alpha = (Fade - DoomTime) / Fade
			alpha = 1 - alpha
			alpha = alpha * 255
		end
		
		if time - DoomTime < Fade then
			alpha = (time - DoomTime) / Fade
			alpha = alpha * 255
		end
		alpha = alpha
		
		draw.RoundedBox( 6, (ScrW() / 2) - (w / 2), ScrH() / 2 - 350, w, 50, Color( 0, 0, 0, alpha / 2 ) )
		
		draw.DrawText(msg, "NotifFont", ScrW() / 2, ScrH() / 2 - 335, Color(255,255,255,alpha), 1)
		
	end
	
	hook.Add( "HUDPaint", "PP.NotifyDraw", PP.Display )
	
end
usermessage.Hook( "PP.Notify", PP.Notify )

function PP.PrintDEBUG( UMSG )
	local msg = UMSG:ReadString()
	
	Print( msg )
	
end
usermessage.Hook( "printdebug", PP.PrintDEBUG )